﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Kokomo.PeInspector.VisualStudioAdapter
{
	/// <summary>
	/// Represents an item within a <see cref="CSharpProject"/> that is to be compiled.
	/// </summary>
	public class CompileItem : ProjectItem
	{
		/// <summary>
		/// Gets or sets the value of the <c>Link</c> attribute.
		/// </summary>
		public string Link { get; set; }
		/// <summary>
		/// Gets or sets the value of the <c>SubType</c> attribute.
		/// </summary>
		public string SubType { get; set; }
		/// <summary>
		/// Gets or sets the value of the <c>AutoGen</c> attribute.
		/// </summary>
		public bool AutoGen { get; set; }
		/// <summary>
		/// Gets or sets the value of the <c>DesignTimeSharedInput</c> attribute.
		/// </summary>
		public bool DesignTimeSharedInput { get; set; }
		/// <summary>
		/// Gets or sets the value of the <c>DependentUpon</c> attribute.
		/// </summary>
		public string DependentUpon { get; set; }

		public override void WriteXml(System.Xml.XmlWriter writer)
		{
			writer.WriteStartElement("Compile");

			base.WriteXmlAttributes(writer);

			if (this.Link != null) writer.WriteElementString("Link", this.Link);
			if (this.SubType != null) writer.WriteElementString("SubType", this.SubType);
			if (this.AutoGen) writer.WriteElementString("AutoGen", "True");
			if (this.DesignTimeSharedInput) writer.WriteElementString("DesignTimeSharedInput", "True");
			if (this.DependentUpon != null) writer.WriteElementString("DependentUpon", this.DependentUpon);

			writer.WriteEndElement();
		}
	}
}
